package coms.service;

import javax.naming.InitialContext;
import javax.naming.NamingException;

import coms.ejb.sessionbean.*;

public class EJBLocator {
	private InitialContext ctx = null;
	private static EJBLocator locator = null;
	
	static{
		locator = new EJBLocator();
	}
	
	private EJBLocator(){
		try{
			ctx = new InitialContext();
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	
	public static EJBLocator getInstance(){
		return locator;
	}
	
	public ReviewBeanRemote lookupReviewBean()  throws NamingException{
		return (ReviewBeanRemote) ctx.lookup("java:app/coms-ejb/ReviewBean!coms.ejb.sessionbean.ReviewBeanRemote");
	}	
	
	public ConferenceBeanRemote lookupConferenceBean()  throws NamingException{
		return (ConferenceBeanRemote) ctx.lookup("java:app/coms-ejb/ConferenceBean!coms.ejb.sessionbean.ConferenceBeanRemote");
	}	
	
	
	public FileBeanRemote lookupFileBean()  throws NamingException{
		return (FileBeanRemote) ctx.lookup("java:app/coms-ejb/FileBean!coms.ejb.sessionbean.FileBeanRemote");
	}
	
	public UserBeanRemote lookupUserBean()  throws NamingException{
		return (UserBeanRemote) ctx.lookup("java:app/coms-ejb/UserBean!coms.ejb.sessionbean.UserBeanRemote");
	}	
	
	public ConferenceItemBeanRemote lookupConferenceItemBean()  throws NamingException{
		return (ConferenceItemBeanRemote) ctx.lookup("java:app/coms-ejb/ConferenceItemBean!coms.ejb.sessionbean.ConferenceItemBeanRemote");
	}

	public PaymentBeanRemote lookupPaymentBean() throws NamingException {
		return (PaymentBeanRemote) ctx.lookup("java:app/coms-ejb/PaymentBean!coms.ejb.sessionbean.PaymentBeanRemote");		
	}	
}
